package com.learnjava.learnjava1.map;

import com.learnjava.learnjava1.dto.CompanyDTO;
import com.learnjava.learnjava1.jpa.entity.CompanyEntity;
import org.mapstruct.*;

import java.util.List;


@Mapper(nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE, componentModel = "spring", uses = DepartmentMapper.class)
public interface CompanyMapper {

    CompanyEntity toEntity(CompanyDTO companyDTO);

    @Named(value = "toDto")
    CompanyDTO toDto(CompanyEntity companyEntity);

    @IterableMapping(qualifiedByName = "toDto")
    CompanyDTO map(CompanyEntity companyEntity);

    void update(CompanyDTO companyDTO, @MappingTarget CompanyEntity companyEntity);

    List<CompanyDTO> toCompaniesDTOList(List<CompanyEntity> companies);

}
